<?xml version="1.0" encoding="UTF-8"?>

<!-- Document : sendConfession.xsl Created on : November 17, 2013, 2:27 PM 
	Author : BAOLA Description: Purpose of transformation follows. -->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:p="http://xml.netbeans.org/schema/page" exclude-result-prefixes="p"
	version="1.0">
    <xsl:output method="html" />
    <xsl:param name="pageId"></xsl:param>
	<!-- TODO customize transformation rules syntax recommendation http://www.w3.org/TR/xslt -->
    <xsl:template match="/">
        <xsl:apply-templates />
    </xsl:template>
    <xsl:template match="p:page">
        <xsl:if test="p:id=$pageId and p:isActive='true'">     
            <table>
                <tr>
                    <td>
                        <img align="middle" alt="">
                            <xsl:attribute name="src">
                                <xsl:value-of select="p:imageLink"></xsl:value-of>
                            </xsl:attribute>
                        </img>
                        <br/>
                        <h4>Send to
                            <xsl:value-of select="p:pagename"></xsl:value-of>
                        </h4>
                    </td>

                </tr>
            </table>
            <form action="sendConfession.action" method="POST" class="form-actions" onsubmit="return validateForm(this)">
                <input type="hidden" name="pageId">
                <xsl:attribute name="value"><xsl:value-of select="$pageId"/></xsl:attribute>
                </input>
                <table>
                    <tr>
                        <td>
                            <h6>Message:</h6>
                            <textarea rows="6" cols="550" name="confess" style="margin: 10px 0px 10px; width: 98%; height: 150px;"></textarea>
                        </td>

                    </tr>
                    <tr>
                        <td>
                            <button type="submit" class="btn btn-primary">Send</button>
                        </td>
                    </tr>
                </table>
            </form>
        </xsl:if>
        <xsl:if test="p:id=$pageId and p:isActive='false'">
            <h4>This page not found!</h4>
        </xsl:if>
    </xsl:template>


</xsl:stylesheet>
